package com.config.client.springevent;

import com.config.client.server.ConfigServer;
import com.registry.client.service.RegistryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

/**
 * ApplicationRunner Spring启动成功后做一些初始化操作，这里也可以用 implements ApplicationListener<ApplicationStartedEvent>代替
 */

public class SpringConfigStartEvent implements ApplicationRunner {

    @Autowired
    private ConfigServer configServer;
    /**
     * 长轮询
     * @param args
     * @throws Exception
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        configServer.longPolling();
    }
}
